<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	template="/xhtml/bases/adminbase.xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:bargas="http://barganhas.com.br/barganhas">

	<ui:define name="headForm">
		<bargas:headFormFilter headText="#{msg.privateAreaAdvertisement} #{msg.privateAreaFormSeparatorHeader} #{msg.privateAreaActionList}">
			<ui:define name="formFilter">
<!-- 				<ui:include src="/xhtml/admin/sales/salesFilter.xhtml"/> -->
			</ui:define>
		</bargas:headFormFilter>
	</ui:define>
	
	<ui:define name="formBody">
		<rich:dataTable id="listAdvertisements"
						styleClass="tableFormList"
						style="border: none;"
						rendered="true"
						rows="#{advertisementBean.dataModel.itensPerPage}"
						rowClasses="rowOdd, rowEven"
						value="#{advertisementBean.dataModel}"
						var="advertisement">
			
			<!-- actions -->
			<rich:column styleClass="columnListActions">
				<bargas:commandListLock id="lockAdvertisement" targetProperty="advertisement" backingBean="#{advertisementBean}"
						action="adminLockAdvertisement" propertyFrom="#{advertisement}" toolTipMessage="#{msg.msgLock} #{msg.advertisement}"
						rendered="#{advertisement.status eq 'ENABLED'}"/>
				<bargas:commandListUnlock id="unlockAdvertisement" targetProperty="advertisement" backingBean="#{advertisementBean}"
						action="adminUnlockAdvertisement" propertyFrom="#{advertisement}" toolTipMessage="#{msg.msgUnlock} #{msg.advertisement}"
						rendered="#{advertisement.status ne 'ENABLED'}"/>
				<bargas:commandListDelete id="deleteAdvertisement" targetProperty="advertisement" backingBean="#{advertisementBean}" 
						action="adminDeleteAdvertisement" propertyFrom="#{advertisement}"
						toolTipMessage="#{msg.privateAreaActionDelete} #{msg.advertisement}"/>
			</rich:column>

			<!-- status -->
			<rich:column >
				<f:facet name="header">
					<h:outputText value="#{msg.msgStatus}"/>
				</f:facet>
				
				<h:commandLink action="#{advertisementBean.adminConsultAdvertisement}" >
					<h:outputText value="#{advertisement.status}">
						<f:converter converterId="ConverterAdvertisementStatus"/>
					</h:outputText>
					<f:setPropertyActionListener value="#{advertisement}" target="#{advertisementBean.advertisement}"/>
				</h:commandLink>
			</rich:column>
			
			<!-- title -->
			<rich:column >
				<f:facet name="header">
					<h:outputText value="#{msg.privateAreaTitle}"/>
				</f:facet>
				
				<h:commandLink action="#{advertisementBean.adminConsultAdvertisement}" >
					<h:outputText value="#{advertisement.title}"/>
					<f:setPropertyActionListener value="#{advertisement}" target="#{advertisementBean.advertisement}"/>
				</h:commandLink>
			</rich:column>
			
			<!-- value -->
			<rich:column >
				<f:facet name="header">
					<h:outputText value="#{msg.privateAreaCurrencyValue}"/>
				</f:facet>
				
				<h:commandLink action="#{advertisementBean.adminConsultAdvertisement}" >
					<h:outputText value="#{advertisement.value}">
						<f:converter converterId="ConverterDoubleCurrencyReal"/>
					</h:outputText>
					<f:setPropertyActionListener value="#{advertisement}" target="#{advertisementBean.advertisement}"/>
				</h:commandLink>
			</rich:column>
			
		</rich:dataTable>
		
		<t:saveState value="#{advertisementBean.dataModel}"/>
	</ui:define>
	
	<ui:define name="formButtons">
		<h:panelGroup layout="block" styleClass="customButton" style="cursor: auto;">
			<h:outputText value="#{msg.privateAreaNoAction}" />
		</h:panelGroup>
	</ui:define>
	
</ui:composition>